<?php

/**
 * Front Controller plug in to set up the action stack.
 *
 */
class Wmp_Controller_Plugin_ActionSetup extends Zend_Controller_Plugin_Abstract
{
    public function routeStartup(Zend_Controller_Request_Abstract $request)
    {
        $this->getResponse()->appendBody("<p>routeStartup() called</p>\n");
    }

    public function routeShutdown(Zend_Controller_Request_Abstract $request)
    {
        $this->getResponse()->appendBody("<p>routeShutdown() called</p>\n");
    }

    public function dispatchLoopStartup(Zend_Controller_Request_Abstract $request)
    {
       $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
       $viewRenderer->init();

       $publicDirName = Zend_Registry::get('config')->path->public->name;
       //$viewRenderer->setViewSuffix($config->views->suffix);        
       $viewRenderer->view->addScriptPath('/opt/lampp/htdocs/webs/wmpsvn/'.$publicDirName.'/templates/');
        //$fc = $viewRenderer->setActionController('toto');
       $frontController = Zend_Controller_Front::getInstance();
       //$frontController->view 
       //Zend_Debug::dump( $frontController->view);exit;	
       $this->getResponse()->appendBody("<p>dispatchLoopStartup() called</p>\n");
    }

    public function preDispatch(Zend_Controller_Request_Abstract $request)
    {
        $this->getResponse()->appendBody("<p>preDispatch() called</p>\n");
    }

    public function postDispatch(Zend_Controller_Request_Abstract $request)
    {
        $this->getResponse()->appendBody("<p>postDispatch() called</p>\n");
    }

    public function dispatchLoopShutdown()
    {
        $this->getResponse()->appendBody("<p>dispatchLoopShutdown() called</p>\n");
    }
}